package api

import (
	"github.com/gin-gonic/gin"
	"shop-api/internal/server"
)

func OrderCreate(c *gin.Context) {
	userID := c.GetUint("user_id")
	req := new(server.CreateOrderReq)
	if err := c.ShouldBindJSON(&req); err != nil {
		Resp(c, nil, err)
		return
	}

	info, err := server.CreateOrder(userID, req)
	if err != nil {
		Resp(c, nil, err)
		return
	}
	Resp(c, info, nil)
	return
}
